package com.tapjoy;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;

public class TapjoyDailyRewardAdWebView extends Activity
{
  final String TAPJOY_DAILY_REWARD = "Daily Reward";
  private String htmlRawData = "";
  private ProgressBar progressBar;
  private WebView webView = null;

  private void finishActivity()
  {
    finish();
  }

  public void onConfigurationChanged(Configuration paramConfiguration)
  {
    super.onConfigurationChanged(paramConfiguration);
    if (this.webView != null)
      new RefreshTask(null).execute(new Void[0]);
  }

  protected void onCreate(Bundle paramBundle)
  {
    this.htmlRawData = getIntent().getExtras().getString("RE_ENGAGEMENT_HTML_DATA");
    super.onCreate(paramBundle);
    requestWindowFeature(1);
    RelativeLayout localRelativeLayout = new RelativeLayout(this);
    this.webView = new WebView(this);
    this.webView.setWebViewClient(new TapjoyWebViewClient(null));
    this.webView.getSettings().setJavaScriptEnabled(true);
    this.progressBar = new ProgressBar(this, null, 16842874);
    this.progressBar.setVisibility(0);
    RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(-2, -2);
    localLayoutParams.addRule(13);
    this.progressBar.setLayoutParams(localLayoutParams);
    localRelativeLayout.addView(this.webView, -1, -1);
    localRelativeLayout.addView(this.progressBar);
    setContentView(localRelativeLayout);
    this.webView.loadDataWithBaseURL("https://ws.tapjoyads.com/", this.htmlRawData, "text/html", "utf-8", null);
    TapjoyLog.i("Daily Reward", "Opening Daily Reward ad = [" + this.htmlRawData + "]");
  }

  private class RefreshTask extends AsyncTask<Void, Void, Boolean>
  {
    private RefreshTask()
    {
    }

    protected Boolean doInBackground(Void[] paramArrayOfVoid)
    {
      try
      {
        Thread.sleep(200L);
        return Boolean.valueOf(true);
      }
      catch (InterruptedException localInterruptedException)
      {
        while (true)
          localInterruptedException.printStackTrace();
      }
    }

    protected void onPostExecute(Boolean paramBoolean)
    {
      if (TapjoyDailyRewardAdWebView.this.webView != null)
        TapjoyDailyRewardAdWebView.this.webView.loadUrl("javascript:window.onorientationchange();");
    }
  }

  private class TapjoyWebViewClient extends WebViewClient
  {
    private TapjoyWebViewClient()
    {
    }

    public void onPageFinished(WebView paramWebView, String paramString)
    {
      TapjoyDailyRewardAdWebView.this.progressBar.setVisibility(8);
    }

    public void onPageStarted(WebView paramWebView, String paramString, Bitmap paramBitmap)
    {
      TapjoyDailyRewardAdWebView.this.progressBar.setVisibility(0);
      TapjoyDailyRewardAdWebView.this.progressBar.bringToFront();
    }

    public boolean shouldOverrideUrlLoading(WebView paramWebView, String paramString)
    {
      TapjoyLog.i("Daily Reward", "URL = [" + paramString + "]");
      if (paramString.startsWith("http://ok"))
      {
        TapjoyLog.i("Daily Reward", "dismiss");
        TapjoyDailyRewardAdWebView.this.finishActivity();
      }
      return true;
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.tapjoy.TapjoyDailyRewardAdWebView
 * JD-Core Version:    0.6.2
 */